import {createBrowserRouter,createHashRouter} from 'react-router-dom'
import {App} from "../App";
import Login from '../pages/Login'
import Article from '../pages/Article'
import Home from "../pages/Home";
import News from "../pages/Home/News";

const router = createHashRouter(
    [
        {
            path: '/',
            element: <App/>
        },
        {
            path: '/login',
            element: <Login/>
        },
        {
            path: '/article/:title/:content',
            element: <Article/>
        },
        {
            path: '/home',
            element: <Home/>,
            children: [
                {
                    // index: true,// 默认子路由
                    path: 'news',
                    element: <News/>
                }
            ]
        },
        {
            //404路由配置
            path: '*',
            element: <div style={{color: 'red', fontSize: '30px'}}>this is not found</div>
        }
    ]
)

export default router
